/*
 * 数据权限
 */
import { getRequest, postRequest } from '/@/lib/axios';

export const dsApi = {
  /**
   * @description: 获取所有配置用户
   * @param {*}
   * @return {*}
   */
  queryAll: () => {
    return getRequest('/sys/ds/queryAll');
  },
  /**
   * @description:更新数据范围
   * @param {*}
   * @return {*}
   */
  updateDatascope: (data) => {
    return postRequest('/sys/ds/save', data);
  },
  /**
   * @description: 删除配置用户
   * @param {number} quarterId
   * @return {*}
   */
  deleteDS: (quarterId) => {
    return getRequest(`/sys/ds/delete?quarterId=${quarterId}`);
  },
  /**
   * @description: 获数据范围绑定/非绑定成员-员工列表
   * @param {*}
   * @return {*}
   */
  queryRelateUser: (params) => {
    return postRequest('/sys/ds/dsRelateUserPage', params);
  },
  /**
   * @description: 数据范围成员列表中批量添加/取消员工
   * @param  data
   * @return {*}
   */
  relateOrCancelUserAuth: (data) => {
    return postRequest('/sys/ds/relateOrCancelUserAuth', data);
  },
   /**
   * @description: 获取数据范围-机构列表
   * @param {*}
   * @return {*}
   */
   queryRoleOrg: (params) => {
    return postRequest('/sys/org/searchPage', params);
  },
  /**
   * @description: 获取数据范围-岗位列表
   * @param {*}
   * @return {*}
   */
  queryRoleQuarter: (params) => {
    return postRequest('/sys/quarter/searchPage', params);
  },
  /**
   * @description:  数据范围关联/移除岗位
   * @param {*}
   * @return {*}
   */
  relateOrCancelQuarterAuth: (params) => {
    return postRequest('/sys/ds/relateOrCancelQuarterAuth', params);
  },
  /**
   * @description: 数据范围关联/移除部门
   * @param {*}
   * @return {*}
   */
  relateOrCancelOrgAuth: (params) => {
    return postRequest('/sys/ds/relateOrCancelOrgAuth', params);
  },
};
